//
// Created by Administrator on 2020/10/21.
//

#ifndef O5G_SRC_O5GUE_INCLUDE_MEMPOOLS_H_
#define O5G_SRC_O5GUE_INCLUDE_MEMPOOLS_H_

#include <stdint.h>

#ifdef __cplusplus
extern "C"
{
#endif

enum
{
    UE_MP_TYPE_L1,
    UE_MP_TYPE_L2,
    UE_MP_TYPE_L3,
    UE_MP_TYPE_MAX
};

int32_t UE_MP_Init(void);
int32_t UE_MP_Final(void);

#define MEM_POOL_GET(RC, TYPE, SIZE) \
do {\
    (RC) = (typeof(RC))MPS_Get(TYPE, SIZE, __func__, __LINE__);\
    if (NULL == (RC))\
    {\
        CSP_LOG_ERR(0, "[%s, %d] MPS_Get failed!\n", __func__, __LINE__);\
    }\
} while(0)

#define MEM_POOL_PUT(RC, BUFFER) \
do {\
    (RC) = MPS_Put(BUFFER);\
    if (RC_OK != (RC))\
    {\
        CSP_LOG_ERR(0, "[%s, %d] MPS_Put failed!\n", __func__, __LINE__);\
    }\
    BUFFER = NULL;\
} while(0)

#ifdef __cplusplus
}
#endif

#endif //O5G_SRC_O5GUE_INCLUDE_MEMPOOLS_H_
